<template>
	<el-dialog :title="titleMap[mode]" v-model="visible" :width="600" destroy-on-close @closed="$emit('closed')" align-center>
        <scTable ref="table" :data="data" stripe border height="350" hideDo hidePagination>
            <el-table-column label="补扣类型" prop="type" align="center">
                <template #default="scope">
                    <el-tag v-if="scope.row.type==1" type="primary">补款</el-tag>
                    <el-tag v-if="scope.row.type==2" type="danger">扣款</el-tag>
                </template>
            </el-table-column>
            <el-table-column label="扣款说明" prop="deduction_title" align="center"></el-table-column>
            <el-table-column label="补扣金额" prop="money" align="center"></el-table-column>
            <el-table-column label="录入时间" prop="date" align="center"></el-table-column>
        </scTable>
        <template #footer>
            <el-button @click="visible = false">取 消</el-button>
        </template>
	</el-dialog>
</template>

<script>
export default {
	emits: ['success', 'closed'],
	data() {
		return {
			mode: "add",
			titleMap: {
				add: '新增员工',
				edit: '补扣明细',
				show: '工资明细'
			},
			visible: false,
			isSaveing: false,
            data:[],
            search:{
                staff_id:null,
            },
		}
	},
	mounted() {
	},
	methods: {
		//显示
		open(mode = 'add') {
			this.mode = mode;
			this.visible = true;
			return this
		},
        async setData(data){
            console.log('data :>> ', data);
            var reqData = { staff_id: data.staff_id, month:data.month,source:data.source};
            var res = await this.$API.inventory.staffSalary.time.get(reqData);
            this.data = res.data.rows
        }
	}
}
</script>

<style>
.el-input-group__append{
    padding: 0 6px;
}
</style>
